package com.sinovatech.ologger.util;

public class NumberFormatterUtil {
	
	public static Double scaleDouble(Double value, int newScale) {
		if (value == null) {
			return value;
		}
		return new java.math.BigDecimal(value).setScale(newScale, java.math.BigDecimal.ROUND_HALF_UP).doubleValue();
	}

	public static Float scaleFloat(Float value, int newScale) {
		if (value == null) {
			return value;
		}
		return new java.math.BigDecimal(value).setScale(newScale, java.math.BigDecimal.ROUND_HALF_UP).floatValue();
	}
}
